﻿using SUNRPA.CONTROLS.IMPL.domain.attrubutes;
using SUNRPA.CONTROLS.IMPL.domain.constant;
using SUNRPA.CONTROLS.IMPL.domain.flowRunningVar;
using SUNRPA.CONTROLS.IMPL.util;
using System.Collections.Concurrent;

namespace SUNRPA.CONTROLS.IMPL.domain.flowItemParam {
    [Serializable]
    [VarFieldName("VarName")]
    public class SetVarNParam:BaseParam {
        private VarialbleType vt = VarialbleType.STRING;
        private string variableValue;
        private string varName = "variable";

        public VarialbleType Vt {
            get => vt; 
            set { 
                vt = value;
                NotifyPropertyChanged("Vt");
            }  
        }
        public string VarName {
            get => varName; 
            set { 
                varName = value;
                NotifyPropertyChanged("VarName");
            }  
        }

        public string VariableValue {
            get => variableValue; 
            set { 
                variableValue = value;
                NotifyPropertyChanged("VariableValue");
            }  
        }

        public string GetTranslateVarialbleType() {
            switch(this.vt) {
                case VarialbleType.STRING:
                    return "字符串";
                    break;
                case VarialbleType.INT:
                    return "整数";
                    break;
                case VarialbleType.DOUBLE:
                    return "小数";
                    break;
                case VarialbleType.BOOL:
                    return "布尔";
                    break;
                case VarialbleType.LIST_SIDB:
                    return "列表(字符串，整数，小数)";
                    break;
                case VarialbleType.DICTIONARY_SIDB:
                    return "字典(字符串，整数，小数)";
                    break;
                case VarialbleType.EMAIL:
                    return "邮箱";
                    break;
                case VarialbleType.WEBPAGE:
                    return "网页";
                    break;
                default:
                    return "字符串";
                    break;
            }
        }
        public override void SetLatestVarName(ConcurrentDictionary<string, ConcurrentDictionary<string, RPAVariableDefineWrapper>> globleData) {
            this.varName = this.GetLatestName(this.varName, globleData);
        }
    }
}
